<?php

// --- Database
define (DB_HOST, "localhost");
define (DB_NAME, "social_gaming_task1");
define (DB_USER, "social1");
define (DB_CODE, "social4task1");

// --- Facebook
define (FB_APPID, "363561467083686");
define (FB_SECRET, "190a4b071f04d06c05fec66c3cc9d58b");

// --- Picture Base
define (PIC_GROUP, 21);
define (PICS, "http://lodsb.org/socialcomp/artemis");

// --- Initialize Facebook
require_once (dirname(__FILE__)."/../sdk/facebook.php");
$FB = new Facebook(array('appId' => FB_APPID, 'secret' => FB_SECRET));
define (FB_USER, $FB->getUser());

// --- Force Authentication
if (!FB_USER) {
    $login_url = $FB->getLoginUrl(array('scope' => 'friends,name,email'));
    header('Location: '.$login_url);
    exit;
}

// --- Session
// session_start();

// --- Render Function
define (BASE, dirname(__FILE__)."/..");
define (PAGE_DIR, BASE."/pages");
define (HEADER_PHP, BASE."/header.php");
define (FOOTER_PHP, BASE."/footer.php");

function render($page) {
    $f = PAGE_DIR."/".$page.".php";
    if (!file_exists($f)) {
        die("No such Page: ".$page);
    }
    include(HEADER_PHP);
    include($f);
    include(FOOTER_PHP);
}

?>
